<template>
  <div id="swiper">
    <van-swipe class="my-swipe" :autoplay="2000" indicator-color="#ff6040">
      <van-swipe-item v-for="item in bannerList" :key="item.id">
        <img :src="'http://localhost:3000' + item.img" alt="" />
      </van-swipe-item>
    </van-swipe>
  </div>
</template>

<script>
import { Banner } from "../util/request/api";
export default {
  data() {
    return {
      bannerList: [],
    };
  },
  mounted() {
    Banner()
      .then((res) => {
        if (res.code == 200) {
          this.bannerList = res.list;
        }
      })
      .catch((err) => {
        console.log(err);
      });
  },
};
</script>

<style scoped>
.my-swipe .van-swipe-item img {
  width: 100%;
  height: 2rem;
}
</style>